package org.csu.jpetstore_cms.service.impl;

import org.csu.jpetstore_cms.mapper.OrderMapper;
import org.csu.jpetstore_cms.pojo.Order;
import org.csu.jpetstore_cms.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;
    //订单的增加
    @Override
    public void insertOrder(Order order) {
        orderMapper.insertOrder();
    }
    //订单的删减
    @Override
    public void deleteAllOrder() {
        orderMapper.deleteAllOrder();
    }
    @Override
    public void deleteOrder(String orderId) {
        orderMapper.deleteOrder(orderId);
    }
    //订单的改变
    @Override
    public void updateOrder(String orderId,Order order) {
        orderMapper.updateOrder(orderId,order);
    }
    //订单的查找
    @Override
    public List<Order> getAllOrder() {
        return orderMapper.getAllOrder();
    }
    @Override
    public Order getOrder(String orderId) {
        return orderMapper.getOrder(orderId);
    }

    @Override
    public List<Order> getAllUnshippedOrder() {
        return orderMapper.getAllUnshippedOrder();
    }

    @Override
    public boolean isOrderShipped(String orderId) {
        return orderMapper.isOrderShipped(orderId);
    }

    @Override
    public boolean shipOrder(String orderId) {
        return orderMapper.shipOrder(orderId);
    }
}
